// pages/booklist/booklist.js
Page({
  data:{
    books: []
  },
  onLoad:function(options){
    // 页面初始化 options为页面跳转所带来的参数
    console.log('options',options);
    var that=this;
    wx.request({
      url: 'https://www.see2eyes.cn//BookApi/BooksByCategory',
      data: {
        typeid: options.typeid 
      },
      header: {
          'content-type': 'application/x-www-form-urlencoded'
      },
      method:"POST",
      success: function(res) {
        console.log(res.data);
        if(res.data.state=="success")
        {
          that.setData({
            books: res.data.books
          })
        }
      },
      fail: function(res) {
        console.log('fail',res)
      },
      complete: function(res) {
        console.log('complete',res)
      }
    })


  },
  onReady:function(){
    // 页面渲染完成
  },
  onShow:function(){
    // 页面显示
  },
  onHide:function(){
    // 页面隐藏
  },
  onUnload:function(){
    // 页面关闭
  }
})